define([
  'jquery',
  'underscore',
  'backbone',
  'text!templates/left-nav.html'
  ], function($, _, Backbone, template) {

  return Backbone.View.extend({
    template : _.template(template),
    events: {
      "click #home"   : "onHome",
      "click #profile-link"   : "onProfile",
      "click #message-link"   : "onMessage",
      "click #employee-link"   : "onEmployee",
      "click #appointment-link"   : "onAppointment"
      /*"click #login-link"   : "onLogin",
      "click #logout-link"   : "onLogout"*/
    },

    render: function() {
        //TODO: We have to set webUser model to check if user is authorization
      //this.$el.html(this.template(this.model.toJSON()));
      /*$('#nav-sidebar').html(this.el);*/
        $(this.el).html(this.template());
        return this;
      /*$('#nav-sidebar').html(this.el);*/
    },

      onLogout: function(event) {
          event.preventDefault();
          console.log("In Progress");
        //Do something here.
      /*event.preventDefault();
      App.vent.trigger('logout');*/
    },
      onProfile: function(event) {
          event.preventDefault();
          console.log("In Progress");
        //Do something here.
    },

      onMessage: function(event) {
          event.preventDefault();
          app.threadMessage();
          app.navigate('thread/message');
//          console.log("In Progress");
        //Do something here.
     },
      onEmployee: function(event) {
          event.preventDefault();
          app.employeeManager();
          app.navigate('employee/list');
        //Do something here.
    },
      onAppointment: function(event) {
          event.preventDefault();
		  app.appointmentSchedule();
		  app.navigate('appointment/index');
//          console.log("In Progress");
        //Do something here.
    },

    onLogin: function(event) {
        event.preventDefault();
        console.log("In Progress");
        //Do something here.
    },
    onHome: function(event) {
        event.preventDefault();
        app.list();
        app.navigate('business/list');
        //console.log("In Progress");
        //Do something here.
    },

    close: function() {
      this.undelegateEvents();
      this.remove();
    }
  });

});
